<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./node_modules/vue/dist/vue.min.js"></script>
    
</head>
<body>
    <div id="app">
      <p>
        单价：<input readonly v-model="price" type="text">
      </p>
      <p>
        数量：<input v-model="count" type="text">
      </p>
      <p>
        总价：{{total}}
      </p>
    </div>
    <script>
        const app = new Vue({
            el:"#app",
            data:{
                price:2,
                count:3,
                total:0
            },
            watch:{
                count(newValue,oldValue){
                    // console.log(newValue,oldValue);
                    this.total = this.price*this.count;
                }
            }
        })
    </script>
</body>
</html>